home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel Volume 2 #1
/
carousel.iso
/
mactosh
/
hc
/
homeimpr.sit
/
Home Improvements
/
background_6079.txt
< prev
next >
Wrap
Text File
|
1988-09-19
|
11KB
|
446 lines
-- background: 6079 from stack: in
-- bmap block id: 6606
-- flags: 0000
-- background id: 0
-- name:
----- HyperTalk script -----
on clickField
if the paramcount<1 then
put 1 into thingg
else
put param(1) into thingg
end if
put the rect of field ID thingg into r2
put item 1 of r2 + 3 into item 1 of pt
put item 2 of r2 + 3 into item 2 of pt
click at pt
end clickField
on arrowKey var
if (the ShiftKey is down) or (var is "right") or (var is "left") then
pass arrowKey
exit arrowKey
end if
if the optionKey is down then
put the rect of field "thetext" into rr
put item 4 of rr into skipp
subtract item 2 of rr from skipp
subtract 9 from skipp -- keep some overlap
else
put 1 into skipp
end if
if var is "up" then put 0-skipp into skipp
put the scroll of field "thetext" into scr
add skipp to scr
if scr<0 then put 0 into scr
set the scroll of field "thetext" to scr
end arrowKey
-- part 1 (field)
-- low flags: 00
-- high flags: 0007
-- rect: left=1 top=18 right=311 bottom=509
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 10
-- part name: theText
----- HyperTalk script -----
on closeField
send mouseUp to field "stats"
end closeField
-- part 2 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=162 top=323 right=342 bottom=210
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: read
----- HyperTalk script -----
on mouseUp
global IOResult, theText
put empty into extension
put 0 into NoErr
put 1 into fsFromStart
put 100 into item 1 of wher
put 100 into item 2 of wher
put empty into rply
put TBxFile("SFGetFile",wher,"What file:",0,1,"TEXT",0,0) into rply
if IOResult <> noErr THEN
put "IO error on SFGetFile " & IOResult
exit mouseUp
end if
if item 1 of rply is false then exit mouseup
get item 4 of rply
put the value of it into theVRefNo
put item 6 of rply into pfname
put TBxFile("FSOpen",pfname, theVRefNo, 0) into refNo
if IOResult <> noErr THEN
put "IO error on FSOpen " & IOResult
exit mouseUp
end if
put empty into logEOF
put TBxFile("GetEOF",refNo, 0) into logEOF
if IOResult <> noErr THEN
put "IO error on GetEOF " & IOResult
exit mouseUp
end if
put the value of logEOF into Siz
If Siz>29990 Then
put Siz & " Characters in the file"
ask "File too large, start reading from:" with 0
if it is empty then exit mouseUp
put the value of it into startPt
if startPt>Siz then put Siz-29990 into startPt
put "reading from " & startPt
put TBxFile("SetFPos",refNo, fsFromStart, startPt) into io
if IOResult <> noErr THEN
put "IO error on SetFPos0 " & IOResult
put TBxFile("FSClose",refNo) into io
put TBxFile("FlushVol",NIL, theVRefNo) into io
answer "An IO error has occured."
exit mouseUp
end if
put " (partial)" into extension
put siz-startPt into siz
if siz>29990 then put 29990 into siz
hide the message window
end if
put empty into theText
put TBxFile("FSRead",refNo, siz, 0) into theText
if IOResult <> noErr then
put "IO error on Read " & IOResult
exit mouseUp
end if
put pfname & extension into field "file name"
put TBxFile("FSClose",refNo) into io
IF IOResult <> noErr THEN
put "IO error on Close " & IOResult
exit mouseUp
end if
put TBxFile("FlushVol",NIL, theVRefNo) into io
IF IOResult <> noErr THEN
put "IO error on Flush " & IOResult
exit mouseUp
end if
put theText into field "theText"
send mouseUp to field "stats"
clickField
end mouseUp
-- part 3 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=210 top=323 right=342 bottom=261
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: write
----- HyperTalk script -----
on mouseUp
global IOResult, theText
put field "file name" into pfname
put 0 into NoErr
put -43 into fnfErr
put 1 into fsFromStart
put 100 into item 1 of wher
put 100 into item 2 of wher
put empty into rply
put TBxFile("SFPutFile",wher,"Save Field as:",pfname,0,0) into rply
if IOResult <> noErr THEN
put "IO error on SFPutFile " & IOResult
exit mouseUp
end if
if item 1 of rply is false then exit mouseup
get item 4 of rply
put the value of it into theVRefNo
put item 6 of rply into pfname
put TBxFile("FSOpen",pfname, theVRefNo, 0) into refNo
if (IOResult <> noErr) AND (IOResult <> fnfErr) THEN
put "IO error on FSOpen " & IOResult
exit mouseUp
end if
if IOResult=fnfErr then
put TBxFile("Create",pfname, theVRefNo, "????","TEXT") into io
if IOResult <> noErr THEN
put "IO error on Create " & IOResult
exit mouseUp
end if
put TBxFile("FSOpen",pfname, theVRefNo, 0) into refNo
if IOResult <> noErr THEN
put "IO error on FSOpen " & IOResult
exit mouseUp
end if
else
put TBxFile("GetEOF",refNo, 0) into logEOF
if IOResult <> noErr THEN
put "IO error on GetEOF " & IOResult
exit mouseUp
end if
put TBxFile("SetFPos",refNo, fsFromStart, logEOF) into io
if IOResult <> noErr THEN
put "IO error on SetFPos " & IOResult
exit mouseUp
end if
end if
put field "theText" into theText
put the length of theText into Siz
put TBxFile("FSWrite",refNo, siz, theText) into io
if IOResult <> noErr then
put "IO error on Write " & IOResult
exit mouseUp
end if
put TBxFile("FSClose",refNo) into io
IF IOResult <> noErr THEN
put "IO error on Close " & IOResult
exit mouseUp
end if
put TBxFile("FlushVol",NIL, theVRefNo) into io
IF IOResult <> noErr THEN
put "IO error on Flush " & IOResult
exit mouseUp
end if
put pfname into field "File Name"
end mouseUp
-- part 4 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=260 top=323 right=342 bottom=386
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: copy to clipboard
----- HyperTalk script -----
on mouseUp
send tabKey
doMenu "Copy Text"
put "The text has been copied to the clipboard."
wait 50 ticks
hide the message window
clickField
end mouseUp
-- part 5 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=386 top=323 right=342 bottom=432
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: print
----- HyperTalk script -----
on mouseUp
printfield "field theText",2
end mouseUp
-- part 6 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=431 top=323 right=342 bottom=463
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: sort
----- HyperTalk script -----
on mouseUp
answer "Ascending or Descending?" with "Cancel" OR "Descending" OR "Ascending"
if it is "Cancel" then exit mouseUp
put "A" into hang
if it is "Descending" then put "D" into hang
put field "theText" into thingg
put empty into field "theText"
put sorter(thingg,hang) into field "theText"
send mouseUp to field "stats"
end mouseUp
-- part 7 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=463 top=322 right=342 bottom=479
-- title width / last selected line: 0
-- icon id / first selected line: 15420 / 15420
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: prev
----- HyperTalk script -----
on mouseUp
go to prev card of this bkgnd
end mouseUp
-- part 8 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=479 top=322 right=342 bottom=495
-- title width / last selected line: 0
-- icon id / first selected line: 16560 / 16560
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: next
----- HyperTalk script -----
on mouseUp
go to next card of this bkgnd
end mouseUp
-- part 9 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=89 top=323 right=342 bottom=162
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: new card
----- HyperTalk script -----
on mouseUp
doMenu "New Card"
put "untitled" into field "file name"
send tabKey
end mouseUp
-- part 10 (field)
-- low flags: 01
-- high flags: 0004
-- rect: left=1 top=314 right=340 bottom=90
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 10
-- part name: stats
----- HyperTalk script -----
on mouseUp
put empty into field "stats"
put the length of field "theText" && "chars" into line 1 of field "stats"
put the number of lines of field "theText" && "lines" into line 2 of field "stats"
end mouseUp
-- part 11 (field)
-- low flags: 01
-- high flags: 0004
-- rect: left=101 top=310 right=325 bottom=454
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 256
-- line height: 10
-- part name: file name
----- HyperTalk script -----
on mouseUp
put field "file name" into pfname
ask "Rename to:" with pfname
if it is not empty then put it into field "file name"
end mouseUp
-- part 12 (button)
-- low flags: 00
-- high flags: 8004
-- rect: left=459 top=310 right=324 bottom=501
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: clear
----- HyperTalk script -----
on mouseUp
if the optionKey is down then
get the short name of this card
if it is "text edit" then
answer "You cannot delete the first text edit card"
exit mouseUp
end if
answer "Delete this card?" with "Cancel" or "OK"
if it is "Cancel" then exit mouseUp
doMenu "Delete Card"
go to prev card
end if
put empty into field "theText"
put empty into field "stats"
put "Untitled" into field "file name"
doMenu "Compact Stack"
send mouseUp to field "stats"
clickField
end mouseUp
-- part 13 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=496 top=322 right=342 bottom=512
-- title width / last selected line: 0
-- icon id / first selected line: 6720 / 6720
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: return
----- HyperTalk script -----
on mouseUp
visual effect iris close
pop card
end mouseUp